﻿<phone:PhoneApplicationPage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:cal="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro"
	xmlns:RealWorldStocks_Client_UI_ViewModels_StockDetails="clr-namespace:RealWorldStocks.Client.UI.ViewModels.StockDetails" 
    xmlns:RealWorldStocks_Client_UI_Controls="clr-namespace:RealWorldStocks.Client.UI.Controls" 
    x:Class="RealWorldStocks.Client.UI.Views.StockDetails.StockDetailsView" 
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="696"
    SupportedOrientations="Portrait"  Orientation="Portrait"
	cal:Bind.AtDesignTime="True"
    shell:SystemTray.IsVisible="True" d:DataContext="{d:DesignData /SampleData/StockDetailsViewModelSampleData.xaml}">
	<phone:PhoneApplicationPage.Resources>
		<DataTemplate x:Key="TitleTemplate">
			<Grid Margin="-12,-24,0,0">
				<Grid.RowDefinitions>
					<RowDefinition Height="0.556*"/>
					<RowDefinition Height="0.444*"/>
				</Grid.RowDefinitions>
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="0.787*"/>
					<ColumnDefinition Width="200"/>
				</Grid.ColumnDefinitions>
				<TextBlock Text="{Binding Snapshot.Symbol, Converter={StaticResource ToUppercaseConverter}}" Style="{StaticResource PhoneTextLargeStyle}"/>
				<TextBlock Text="{Binding Snapshot.Company}" Grid.Row="1" Style="{StaticResource PhoneTextNormalStyle}"/>
				<StackPanel Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal" Margin="0,0,12,0">
					<TextBlock Text="{Binding Snapshot.LastPrice}" Style="{StaticResource PhoneTextNormalStyle}" VerticalAlignment="Center" Margin="0,0,12,0" Foreground="{Binding Snapshot.DaysChange, Converter={StaticResource PriceChangeColorConverter}}" FontSize="26.667" />
					<RealWorldStocks_Client_UI_Controls:PriceChangeArrow Price="{Binding Snapshot.DaysChange}" Foreground="{Binding Snapshot.DaysChange, Converter={StaticResource PriceChangeColorConverter}}" Height="30" Width="30" Margin="0,3"/>
				</StackPanel>
				<StackPanel Grid.Column="1" Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
					<TextBlock Text="{Binding Snapshot.DaysChangeFormatted}" Style="{StaticResource PhoneTextNormalStyle}"  Foreground="{Binding Snapshot.DaysChange, Converter={StaticResource PriceChangeColorConverter}}" HorizontalAlignment="Right"  />
					<TextBlock Text="{Binding Snapshot.DaysChangePercentFormatted}" Style="{StaticResource PhoneTextSubtleStyle}"  Foreground="{Binding Snapshot.DaysChange, Converter={StaticResource PriceChangeColorConverter}}" HorizontalAlignment="Right"/>
				</StackPanel>
			</Grid>
		</DataTemplate>
	</phone:PhoneApplicationPage.Resources>
	<phone:PhoneApplicationPage.FontFamily>
		<StaticResource ResourceKey="PhoneFontFamilyNormal"/>
	</phone:PhoneApplicationPage.FontFamily>
	<phone:PhoneApplicationPage.FontSize>
		<StaticResource ResourceKey="PhoneFontSizeNormal"/>
	</phone:PhoneApplicationPage.FontSize>
	<phone:PhoneApplicationPage.Foreground>
		<StaticResource ResourceKey="PhoneForegroundBrush"/>
	</phone:PhoneApplicationPage.Foreground>
	<phone:PhoneApplicationPage.Style>
		<StaticResource ResourceKey="DefaultPageTransitionStyle"/>
	</phone:PhoneApplicationPage.Style>

    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="false">
        	<cal:AppBarButton Text="Refresh" Message="RefreshData" IconUri="/Assets/Icons/appbar.refresh.rest.png"/>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>


    <Grid x:Name="LayoutRoot" Background="Transparent" >
    	<controls:Pivot x:Name="Items" Title="{Binding}"  TitleTemplate="{StaticResource TitleTemplate}">
    		<controls:Pivot.HeaderTemplate>
    			<DataTemplate>
    				<TextBlock Text="{Binding DisplayName}" />
    			</DataTemplate>
    		</controls:Pivot.HeaderTemplate>
    	</controls:Pivot>
    </Grid>

</phone:PhoneApplicationPage>